package com.ruoyi.merchant.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
/**
 * @author 郭艳艳
 * @date 2024/9/18 9:15
 * @description TencentMapUtils
 */
public class TencentMapUtils {
    // 1. 工具类
    public static StringBuffer getTencentMap(String keyUrl) {
        //请求的url
        URL url = null;
        //请求的输入流
        BufferedReader in = null;
        //输入流的缓冲
        StringBuffer sb = new StringBuffer();
        try {
            url = new URL(keyUrl);
            in = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
            String str = null;
            //一行一行进行读入
            while ((str = in.readLine()) != null) {
                sb.append(str);
            }
        } catch (Exception ex) {
            System.out.println("读取出现异常...");
        } finally {
            try {
                if (in != null) {
                    in.close(); //关闭流
                }
            } catch (IOException ex) {
                System.out.println("关闭资源出现异常");
            } finally {
                return sb;
            }
        }
    }
}
